package com.itheima.homework;

import java.util.Scanner;

/*2、  【编号：802】

        已知用户名和密码，请用程序实现模拟用户登录。总共给三次机会，
        是否登录成功，给出相应的提示。*/
//考察equals
class Msg {
    private String name;
    private String passWord;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public Msg() {

    }

    public Msg(String name, String passWord) {

        this.name = name;
        this.passWord = passWord;
    }
}

public class HomeWork02 {
    public static void main(String[] args) {
        for (int i = 1; i <= 3; i++) {


            Scanner sc = new Scanner(System.in);
            Msg m1 = new Msg();
            String name = "陈辉";
            String passWord = "333444";
            System.out.println("请输入用户名");
            String name1 = sc.nextLine();
            System.out.println("请输入密码");
            String passWord1 = sc.nextLine();
            if (name.equals(name1) && (passWord.equals(passWord1))) {
                System.out.println("登录成功!");
                break;
            } else if (i == 3) {
                System.out.println("您今天的输入次数已用完,请明天再来!");
            } else {
                System.out.println("您的输入有误,还剩" + (3 - i) + "次机会");
            }

        }
    }
}
